<template>
  <div class="exception">
    <div class="content">
      <h1>{{ config[type].title }}</h1>
      <van-image width="100" height="100" :src="config[type].img" />
      <div class="desc">{{ config[type].desc }}</div>
      <div class="actions">
        <van-button type="warning" @click="handleToHome">返回首页</van-button>
      </div>
    </div>
  </div>
</template>

<script>
import types from "./type";

export default {
  name: "Exception",
  props: {
    type: {
      type: String,
      default: "404"
    }
  },
  data() {
    return {
      config: types
    };
  },
  methods: {
    handleToHome() {
      this.$router.push({ path: "/" });
    }
  }
};
</script>
//
<style lang="less">
.exception {
  display: flex;
  align-items: center;
  height: 80%;
  min-height: 500px;
  text-align: center;
  .content {
    flex: auto;

    h1 {
      margin-bottom: 24px;
      color: #434e59;
      font-weight: 600;
      font-size: 72px;
      line-height: 72px;
    }

    .desc {
      margin-bottom: 16px;
      color: #1890ff;
      font-size: 20px;
      line-height: 28px;
    }

    .actions {
      button:not(:last-child) {
        margin-right: 8px;
      }
    }
  }
}
</style>
